<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

<title>matrix项目管理</title>
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<link href="${path }/resource/css/login.min.css" rel="stylesheet">
 <script type="text/javascript" src="${path }/resource/js/jquery.cookie.js"></script>   


<!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
<script>
	if (window.top !== window.self) {
		window.top.location = window.location
	};
</script>

</head>

<body class="signin" onkeypress="dologin(event)">
	<div class="row">
		<div class="col-sm-12  text-center title">
			<!-- <span class="f1" >2017 GeeK</span ><span class="f2"> | </span>-->
			 <span class="f3"> 突破、创新，砥砺前行</span> 
		</div>
	</div>
	<div class="signinpanel">
		<div class="row">
			
			<div class="col-sm-12">
				<form method="post" method="post" class="dataForm">
					<h2 class="text-center" ><b>Sign in</b></h2>
					
					<input id="account" type="text" placeholder="账户"
						class="form-control uname" name="account" /> <input id="password"
						type="password" class="form-control pword m-b" name="password"
						nullmsg="密码不能为空" placeholder="密码" /> <a href=""> </a>
					<br>
					<button type="button" onclick="login()"
						class="btn  btn-block">登录</button>
						<br>
					  <h3  ><a href="${path }/interface/welcome" style="color:#fff;"><i class="fa fa-arrow-circle-right"></i>接口查看</a></h3>  
				</form>
			</div>
		</div>
		<div class="signup-footer">
			&copy; 2016 All Rights Reserved. Matrix
		</div>
	</div>
</body>
<script type="text/javascript">
$(function(){
	
	if($.cookie('a')){
		$("#account").val($.cookie('a'));
		$("#password").val($.cookie('w'));
	}
})
	function login() {
		if ($("#account").val() == "") {
			layer.tips('请输入账号！', '#account');
			return false;
		} else if ($("#password").val() == "") {
			layer.tips('请输入密码！', '#password');
			return false;
		}
		console.log($("#password").val());

		$.AjaxProxy({
			p : {
				account : $("#account").val(),
				password : $("#password").val()
			}
		}).invoke("${path}/common/dologin", function(loj) {
			//保存账号密码
			$.cookie('a', $("#account").val(),{ expires: 7 }); 
			$.cookie('w', $("#password").val(),{ expires: 7 }); 
			
			MTools.redirect("${path}/" + loj.getValue("page"));
		});
	}
	function dologin(e) {
		if (e.keyCode == 13) {
			e.preventDefault();
			window.event.returnValue = false;
			login();
			return false;
		}
	}
</script>
</html>